<?php
namespace Home\Model;
use Think\Model;
class liuyanModel extends Model{
   protected $_validate = array(
     array('username','require','用户名不能为空',), 
      array('password','require','密码不能为空',), 
     array('repassword','password','确认密码不正确',0,'confirm'),
     array('username','checkName','用户名不符合要求。',0,'function'),
	    );

}
function checkName($username){
	$user = D("liuyan");
	$username = $_POST['username'];
	$userinfo = $user->where("username ='$username'")->find();
    if(!empty($userinfo)){
        return true;
    }else{
        return false;
    }
}
?>